package com.example.springboot.config.amqp.rabbitmq.fanoutconsumer;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.FanoutExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * fanout型配置类
 *
 * @Author:ChenZhangKun
 * @Date: 2021/5/14 14:54
 */
@Configuration
public class FanoutRabbitConfig {
    @Bean
    public Queue queue1() {
        return new Queue("fanout.A");
    }

    @Bean
    public Queue queue2() {
        return new Queue("fanout.B");
    }

    @Bean
    public Queue queue3() {
        return new Queue("fanout.C");
    }

    @Bean
    public FanoutExchange exchange1() {
        return new FanoutExchange("fanoutExchange2");
    }

    @Bean
    public Binding binding1() {
        return BindingBuilder.bind(queue1()).to(exchange1());
    }

    @Bean
    public Binding binding2() {
        return BindingBuilder.bind(queue2()).to(exchange1());
    }

    @Bean
    public Binding binding3() {
        return BindingBuilder.bind(queue3()).to(exchange1());
    }
}
